<script src="__STATIC__/plugins/laydate/laydate.js"></script>
<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-body">
                <form class="form-inline" name="searchForm" id="searchForm" action="" method="GET">
                    <div class="form-group">
                        <input id="start_date" style="background: #fff" readonly name="start_date" value="{$start_date ? $start_date : '' ;}"
                               class=" form-control input-sm" placeholder="起始日期">
                    </div>
                    <div class="form-group">
                        <input id="end_date" style="background: #fff" readonly name="end_date" value="{$end_date ? $end_date : '' ;}"
                               class=" form-control input-sm " placeholder="截止日期">
                    </div>
                    <div class="form-group" >
                        <input value="{$keywords ? $keywords : '' ;}"
                               name="keywords" id="keywords" class="form-control input-sm" placeholder="关键字">
                    </div>
                    <div class="form-group">
                        <button class="btn btn-sm btn-primary" type="submit"><i class="fa fa-search"></i> 查询
                        </button>
                    </div>
                    <div class="form-group">
                        <button onclick="clear_form()" class="btn btn-sm btn-default" type="button">
                            <i class="fa  fa-eraser"></i> 清空查询
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-body table-responsive">
                <table id="datalist" class="table table-hover table-bordered datatable" width="100%">
                    <thead>
                    <tr>
                        <th>日志ID</th>
                        <th>错误消息</th>
                        <th>所在文件</th>
                        <th>所在行数</th>
                        <th>记录日期</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="list" item="item"}
                    <tr>
                        <td>{$item.id}</td>
                        <td class="td-log" title="{$item.message}">{$item.message}</td>
                        <td  class="td-log" title="{$item.file}">{$item.file}</td>
                        <td>{$item.line}</td>
                        <td>{$item.create_time}</td>
                        <td class="td-do">
                            <a data-id="{$item.id}" data-url="trace" data-confirm="2" data-type="2"
                               class="btn btn-default btn-xs AjaxButton" title="查看Trace">
                                <i class="fa fa-eye"></i>
                            </a>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
            {include file="template/data_footer" /}
        </div>
    </div>
</div>

<script>
    var start = {
        elem: '#start_date',
        max: laydate.now(),
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas; //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end_date',
        max: laydate.now(),
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
</script>